package de.koller.worlders.engine.environment;

import de.koller.oceanFramework.tree.Mother;
import de.koller.oceanFramework.util.ColorIntUtil;
import de.koller.worlders.WSea;
import de.koller.worlders.render.VisualMap;

public class DayCycle extends WSea {
	
	@Mother private EnvRoot eroot;
	
	private float daytime;

	@Override
	protected void update( int elapsedTime ) {
		super.update( elapsedTime );
		
		daytime += 0.0003 * elapsedTime;
		int c = (int)( (Math.sin( daytime ) + 1f) * 0.5f * 0xff );
		eroot.setDayLight( ColorIntUtil.getIntColor( 0xff, c, c, c ) );
		VisualMap.sky.setRenderColor( ColorIntUtil.getIntColor( 0xff, 0xff-c, 0xff-c, 0xff ) );
	}
	
}
